package com.cxx.purchasecharge.dal;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.cxx.purchasecharge.core.model.ContractStatusCode;
import com.cxx.purchasecharge.core.model.persistence.Contract;
import com.cxx.purchasecharge.dal.common.GenericCRUDDao;

@Transactional
public interface ContractDao extends GenericCRUDDao <Contract, Long>
{

    public Contract findById (long id);

    public List <Contract> findByNameLike (String name);
    
    @Query (value = "select c from Contract c where c.customerId=?1")
    public List <Contract> findByCustomer (String customerId);
    
    @Query (value = "select c from Contract c where c.statusCode=?1")
    public List <Contract> findByStatus (ContractStatusCode statusCode);

}
